/**
 * 项目示例-列表表头
 * Date 2023-5-25 09:33:56
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */

export const deviceColumns = [
  { type: 'index', label: '序号', width: 60, align: 'center' },
  { prop: 'eqptCode', label: '设备编号  ', minWidth: 120, sortable: 'custom', align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'typeName', label: '设备类型', minWidth: 120, align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'eqptName', label: '设备名称  ', minWidth: 120, sortable: 'custom', align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'eqptModel', label: '设备型号', minWidth: 120, align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'useOrgans', label: '使用部门', minWidth: 120, align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'owners', label: '归属单位', minWidth: 120, align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  } },
  { prop: 'position', label: '位置', minWidth: 120, align: 'center',
  formatter (row: any, column: any, cellValue: string) {
  // @ts-ignore
    if (cellValue && cellValue.trim() != '') {
    // @ts-ignore
      return cellValue
    } else {
      return '-'
    }
  }},
  {
    prop: 'coordinate',
    label: '地图坐标',
    minWidth: 120,
    align: 'center',
    formatter (row: any, column: any, cellValue: string) {
    // @ts-ignore
      if (cellValue?.latitude && cellValue?.longitude) {
      // @ts-ignore
        return '(' + cellValue.latitude + ',' + cellValue?.longitude + ')'
      } else {
        return '-'
      }
    }
  },
  { prop: 'action', label: '操作', fixed: 'right', width: 210, align: 'center' }

]

export const thresholdListColumns = [
  { prop: 'area', label: '区域', width: 80, align: 'center' },
  { prop: 'historicalAverage', label: '历史平均值', minWidth: 100, align: 'center' },
  { prop: 'isAlarm', label: '是否报警', minWidth: 100, align: 'center' },
  { prop: 'setThreshold', label: '设置阈值', minWidth: 100, align: 'center' }
]
